//
//  LCMessageCenterVC.m
//  LongChain
//
//  Created by FengZi on 2018/3/27.
//  Copyright © 2018年 FengZi. All rights reserved.
//

#import "LCMessageCenterVC.h"
#import "LCMessageCell.h"

@interface LCMessageCenterVC ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>

@end

@implementation LCMessageCenterVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    NSInteger row = indexPath.row;
    LCMessageCell *messageCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"messageCell" forIndexPath:indexPath];
    [messageCell lc_updateMessageCenterCellWithParameter:@"" index:row];
    messageCell.operationBlock = ^(NSInteger row) {
        LCLog(@"点击第 %ld 行 ",(long)row);
    };
    
    return messageCell;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 10;
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    return CGSizeMake(SWidth, 100);
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    LCLog(@"点击消息列表 展开");
    LCMessageCell *message = (LCMessageCell *)[collectionView cellForItemAtIndexPath:indexPath];
    message.directionImage.transform = CGAffineTransformMakeRotation(M_PI);

}

- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath {
    LCLog(@"点击收起");
    LCMessageCell *message = (LCMessageCell *)[collectionView cellForItemAtIndexPath:indexPath];
    message.directionImage.transform = CGAffineTransformMakeRotation(M_PI * 2);
    [collectionView reloadItemsAtIndexPaths:@[indexPath]];



}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
